let express = require('express');
let router = express.Router();


/* GET home page. */


/**
 * 用户注册
 */
router.all('/addDictionary', function (req, res, next) {
    global['bean'].DictionaryService.addDictionaryEntity(req.args).then(data => {
        res.json(res.wrap(20000, '添加成功!', data));
    }).catch(e => {
        next(e);
    });
});


/**
 * 删除角色
 */
router.all('/removeDictionary', function (req, res, next) {
    global['bean'].DictionaryService.removeDictionaryEntity(req.args).then(data => {
        res.json(res.wrap(20000, '删除成功!', data))
    }).catch(e => {
        next(e);
    });
});


/**
 * 更新角色
 */
router.all('/updateDictionary', function (req, res, next) {
    global['bean'].DictionaryService.updateDictionaryEntity(req.args).then(data => {
        res.json(res.wrap(20000, '更新成功', data))
    }).catch(e => {
        next(e);
    });
});

/**
 * 删除角色
 */
router.all('/listDictionarys', function (req, res, next) {
    global['bean'].DictionaryService.listDictionaryEntities(req.args.start || 0, req.args.size || 10,req.args.keyWord).then(data => {
        res.json(res.wrap(20000, '查询', data))
    }).catch(e => {
        next(e);
    });
});

module.exports = router;
